#ifndef HIGHLIGHTER_HPP
#define HIGHLIGHTER_HPP

#include <QSyntaxHighlighter>
#include <QList>
#include <QTextCharFormat>

class QTextDocument;

class Highlighter : public QSyntaxHighlighter {
    Q_OBJECT

public:
    Highlighter(QTextDocument *parent = 0);
    void addCustomHighlightingRule(QString s, int type);
    void reset();
    void initialize();

protected:
    void highlightBlock(const QString &text);

private:

    struct HighlightingRule {
        QRegExp pattern;
        QTextCharFormat format;
    };

    QList<HighlightingRule> highlightingRules;
    QList<HighlightingRule> additionalRules;

    QTextCharFormat variableFormat;
    QTextCharFormat labelFormat;

signals:
    void customTooltip(QString item, QString tooltip);
};

#endif // HIGHLIGHTER_HPP
